{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "# Example: Regenerating Data from\n",
    "# [R. Wu et al. / Elec Acta 54 25 (2010) 7394–7403](http://www.sciencedirect.com/science/article/pii/S0013468610009503)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Import the modules"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import scipy as sp\n",
    "import numpy as np\n",
    "import openpnm as op\n", "%config InlineBackend.figure_formats = ['svg']\n",
    "import matplotlib.pyplot as plt\n",
    "import openpnm.models.geometry as gm\n",
    "import openpnm.topotools as tt\n",
    "%matplotlib inline\n",
    "np.random.seed(10)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Set the workspace loglevel to not print anything"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "ws = op.Workspace()\n",
    "ws.settings[\"loglevel\"] = 50"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "%run shared_funcs.ipynb"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "We can also investigate the effect of network size on the single phase diffusivity"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "y_2_values = []\n",
    "\n",
    "n_values = [8, 10, 12, 14, 16, 18, 20]\n",
    "\n",
    "for x in range(5):\n",
    "    for n in n_values:\n",
    "        x_ensemble, y_ensemble = simulation(n=n, npts=1)\n",
    "        y_2_values.append(y_ensemble)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "scrolled": true
   },
   "outputs": [],
   "source": [
    "y_2_values = np.asarray(y_2_values).flatten()\n",
    "plt.figure()\n",
    "plt.plot(n_values + n_values + n_values + n_values + n_values, y_2_values, 'ro')\n",
    "plt.title('F(epsilon) versus N')\n",
    "plt.xlabel('N')\n",
    "plt.ylabel('F(epsilon)')\n",
    "#plt.axis(xmin = 6,xmax = 22,ymin= 0,ymax = .2)\n",
    "plt.show()"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
